import requests


def login(data):
    URL = 'https://testpassport.rabbitpre.com/api/sso/login'
    try:
        r = requests.post(url=URL, json=data)
        res = r.json()
        if r.status_code == 200 and res.get('code') == '200' :
            print('登陆成功')
        else:
            raise Exception(res.get('msg'))
    except Exception as e:
        print('登陆失败:{}'.format(e))


if __name__ == '__main__':
    data = {"account": "18576626619", "password": "111111", "fromType": "pc"}
    login(data)
